package com.ccc.mr.flowsum_partition;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class PhoneNumPartition extends Partitioner<Text, FlowBean> {
    @Override
    public int getPartition(Text text, FlowBean flowBean, int i) {
        String preNum = text.toString().substring(0, 3);
        int partition;
        if ("136".equals(preNum))
            partition = 0;
        else if ("137".equals(preNum))
            partition = 1;
        else if ("138".equals(preNum))
            partition = 2;
        else
            partition = 3;
        return partition;
    }
}
